<%--
 *  File:    CountyAreaEdit.jsp
 *  @Author: JackYin 
 *  Date:    2011/1/12
 *
 *  Copyright (C) 2000 - 2010 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%
  //init param
  Category cat = Category.getInstance("jsp.CountyAreaEdit");
  String strModuleName = "ERM";
  String privilegeCode = "10385";
  String contextPath = request.getContextPath();
%>
<% //--------------------  include files list --%>
<%@ include file="/inc/CommonHeader.inc" %>
<%@ page contentType = "text/html;charset=UTF-8" %>
<html>
<head>
<title>HospitalEdit</title>
<PageFlow:CheckPageFlow pageName="p_countyareadetail"/>
<%@ include file="/inc/CatchError.inc" %>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=contextPath %>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath %>/js/ScriptLib.js"></script>
<%
String strDisplayFlag="";
if(request.getParameter("displayflag")!=null)
{
  strDisplayFlag=request.getParameter("displayflag");
}
String IsEdit="";
if(request.getParameter("orgid")!=null)
{
  IsEdit="edit";
}
%>
<script language="JavaScript">
function page_save()
{
	if(!checkForm(document.cform))return; 
	if(emptyToNull(document.cform))return;
	document.cform.target = "_self";
	var orgid=document.cform.orgid.value;  
	if(orgid==""){
		document.cform.actionname.value="add";
	}else{
		document.cform.actionname.value="modify";
	}
	<%if(!(IsEdit).equals("edit")){%>					
	setTimeout("__clickedTab(document.getElementById('attributeTab'),'/oval/zyl/masterdata/erm/ZylMasterdataRelationship.jsp?globalpccode=116');","800");
	<%} %>
	__submitData('countryareaedit_frm',true);	 
  
}

var popwindow;

function page_setRegion(code,name)
{
  if(code != document.cform.regioncode.value)
  {
    document.cform.citycode.value = " ";
    document.cform.cityname.value = " ";
  }
  document.cform.regioncode.value = code;
  document.cform.regionname.value = name;
  if (popwindow != null)
    popwindow.close();
}

function page_selectProvince()
{
  if(popwindow!=null)
    popwindow.close();
  popwindow = window.open('<%=contextPath %>/masterdata/ogm/RegionSelect.jsp?<%= OvalTools.randomURL() %>&languagecode=<%= strLanguageCode %>&countrycode=CN','newwindow', 'height=250, width=500,top=100,left=100,toolbar=n0, menubar=no, scrollbars=no, resizable=no, location=no, status=no');
}

 function page_selectCity(flag,grade)
 {
   var regioncode = document.cform.regioncode.value;
   var parentcitycode = document.cform.citycode.value;
   if(flag=="city")parentcitycode='null';
   if(regioncode=="" || regioncode==-1)
   {
     alert("<%= message.getMessageDesc("MUST_SELECT_FIRST",label.getLabelName("L_Province"))%>");
     return;
     if(parentcitycode=="" || parentcitycode==-1)
   {
     alert("<%= message.getMessageDesc("MUST_SELECT_FIRST",label.getLabelName("L_City"))%>");
     return;
   }
   }
     var url='<%=contextPath %>/masterdata/ogm/CitySelect.jsp?<%= OvalTools.randomURL() %>&languagecode=<%= strLanguageCode %>&countrycode=CN&regioncode=' + regioncode + '&flag=' + flag+'&grade='+grade;
  if(flag=="county"){
   url=url+'&parentcitycode='+parentcitycode;
  }
   if(popwindow!=null)
     popwindow.close();
   popwindow = window.open(url,'newwindow', 'height=250, width=400,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no');
 } 
 

 function page_setCity(code,name,id,flag)
 {
 	if(flag == "county"){
 		document.cform.countycode.value = code;
 		document.cform.countyname.value = name;
 	}else {
 		document.cform.citycode.value = code;
 		document.cform.cityname.value = name;
 		document.cform.countycode.value = " ";
     	document.cform.countyname.value = " ";
 	}
   if (popwindow != null)
     popwindow.close();
 }


function page_setOrg(id,name,code)
{
  document.cform.parentorgid.value = id;
  document.cform.parentorgcode.value = code;  
  document.cform.parentorgname.value = name;
  var remote = window.open("","newwindow");
  if (remote != null)
    remote.close();s
    alert(document.cform.parentorgname.value);
}

function setBusinessarea(id,areaname){
	document.cform.businessareaid.value=id;
	document.cform.areaname.value=areaname;
	
}

function popBusinessarea(){
	if(popwindow!=null) popwindow.close();
    url = '<%=contextPath %>/zyl/masterdata/erm/BusinessAreaPop.jsp?<%= OvalTools.randomURL() %>';
    attribute = 'height=500, width=250,top=100,left=100,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no';
	popwindow = window.open(url,'newwindow', attribute);
}

function page_back(){
	self.location.href='CountyAreaSummary.jsp?<%= OvalTools.randomURL()%>&summaryidentify=countyarea';
}

function page_showExtendInfo(){
	document.getElementById("extendinfo").style.display="block";
	document.getElementById("showbutton").style.display="none";
	document.getElementById("hiddenbutton").style.display="block";
}

function page_hiddenExtendInfo(){
	document.getElementById("showbutton").style.display="block";
	document.getElementById("extendinfo").style.display="none";
	document.getElementById("hiddenbutton").style.display="none";
}
</script>
</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" cellspacing="0" cellpadding="0">
  <tr>
    <td class="summary_top"></td>
  </tr>
</table>
<table width="100%" cellspacing="0" cellpadding="0" >
<form id="countryareaedit_frm" name="cform" method="post" action="<%=contextPath %>/Dispatcher" target="_self">
<input type="hidden" name="pagename" value="p_countyareadetail">
<custom:hidden property="detailactionname" changedName="actionname"/>
<custom:hidden property="detailactionname"/>
<custom:hidden property="orgid" name="countyareadetail"/>
<custom:hidden property="infoid" name="countyareadetail"/>
<%
	boolean codereadonly = false;
	HashMap countyareadetail = (HashMap)pageContext.getAttribute("countyareadetail");
	String countyareacode = null;
	if(pageContext.getAttribute("countyareadetail") != null ){
		codereadonly = true;
		countyareacode = (String)countyareadetail.get("countyareacode");
	}
%>
  <tr> 
    <td valign="top"> 
        <table border="1" cellspacing="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" align="center" width="100%" cellpadding="1">
          <%if(!(strDisplayFlag).equals("view")){%>
		  <tr>
			 <td colspan="4" class="td_right"><a onclick="page_save()"><custom:button
			  type="2" label="L_Save" imgsrc="save_btn.gif" border="0" /></a></td>
		  </tr>
		  <%}%>
          <tr> 
             <%
				if(countyareacode!=null){
			 %>
             <td class="td-text" width="20%"><%=label.getLabelName("L_CountyregionalCode") + label.getLabelName("L_Colon") %></td>
             <td width="30%"><custom:text property="countyareacode" name="countyareadetail" readonly="true" style="border:0;width:100%" size="20"/></td>
             <%}else{%>
			 <td class="td-text" width="20%"><%=label.getLabelName("L_CountyregionalCode") + label.getLabelName("L_Colon") %></td>
             <td width="30%"><custom:text property="countyareacode" name="countyareadetail" size="20"/></td>
			 <%}%>
             <td class="td-text" width="20%"><%= label.getLabelName("L_InfoDeptReferenceNo") + label.getLabelName("L_Colon") %></td>
            <td width="30%">
           	<custom:text property="referenceorgcode" name="countyareadetail" readonly="true" style="border:0;width:100%"  size="20" />
            </td>
          </tr>
          <tr>
            <td class="need" ><%= label.getLabelName("L_CountyregionalName") + label.getLabelName("L_Colon") %></td>
            <td><custom:text property="countyareaname" name="countyareadetail" command="notnull" label="L_CountyregionalName"/></td>
            <td class="td-text"><%= label.getLabelName("L_CountyregionalShortName") + label.getLabelName("L_Colon") %></td>
            <td><custom:text property="shortname" name="countyareadetail"  label="L_CountyregionalShortName"/></td>
          </tr>
          <tr>
          <td class="need"><%= label.getLabelName("L_SCMRole") + label.getLabelName("L_Colon") %></td>
            <td><custom:selectdic dictType="GlobalPCCode" property="globalpccode" name="countyareadetail"  command="notnull" label="L_SCMRole" valueCriteria="116" disabled="true" ></custom:selectdic></td>
            <td class="need"><%= label.getLabelName("L_Province") + label.getLabelName("L_Colon") %></td>
            <td> 
               <%if(!isView){ %>
            	<custom:text property="regioncode" name="countyareadetail" command="notnull" label="L_Province" size="10" readonly="true"/>
            	<a onclick="javascript:page_selectProvince();"><custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0"/></a>
            	<custom:text property="regionname" name="countyareadetail" readonly="true" size="20"/>
           <%}else{ %>
           <custom:write  property="regioncode" name="countyareadetail" nbsp="true"></custom:write>
            <custom:write  property="regionname" name="countyareadetail" nbsp="true"></custom:write>
           <%} %>
            </td>
          </tr>
          <tr>
          	<td class="td-text"><%= label.getLabelName("L_City") + label.getLabelName("L_Colon") %></td>
          	<td>
          	 <%if(!isView){ %>
          		<custom:text property="citycode" name="countyareadetail" command="" label="L_City"  size="10" readonly="true"/>
            	<a onclick="javascript:page_selectCity('city',1);"><custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0"/></a>
            	<custom:text property="cityname" name="countyareadetail" readonly="true" size="20"/>
            <%}else{ %>
           <custom:write  property="citycode" name="countyareadetail" nbsp="true"></custom:write>
            <custom:write  property="cityname" name="countyareadetail" nbsp="true"></custom:write>
           <%} %>
            </td>
            <td class="td-text"><%= label.getLabelName("L_YLCounty") + label.getLabelName("L_Colon") %></td>
            <td>
             <%if(!isView){ %>
            	<custom:text property="countycode" name="countyareadetail" size="10" command="" label="L_YLCounty" readonly="true"/>
              	<a onclick="javascript:page_selectCity('county',2);"><custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0"/></a>
              	<custom:text property="countyname" name="countyareadetail" readonly="true" size="20"/>
            <%}else{ %>
           <custom:write  property="countycode" name="countyareadetail" nbsp="true"></custom:write>
            <custom:write  property="countyname" name="countyareadetail" nbsp="true"></custom:write>
           <%} %>
            </td>
           </tr>
           <tr>
          	<td class="need"><%= label.getLabelName("L_Status") + label.getLabelName("L_Colon") %></td>
            <td><custom:select optionsName="allstatus" optionValueKey="statusvalue" optionInnerTextKey="statusname" name="countyareadetail" label="L_StatusName" property="status" defaultValue="----" defaultValueCost="" command="notnull" defaultValueCost="41"/></td>
          	<!--<td class="need"><%= label.getLabelName("L_BusinessAreaName") + label.getLabelName("L_Colon") %></td>
            	    <td>
				<custom:hidden name="countyareadetail" property="businessareaid"/>
				<%if(!isView){%>
				<custom:text name="countyareadetail" property="areaname" command="notnull" label="L_BusinessAreaName" readonly="true"/>
				<%}else{%>
				<custom:write name="countyareadetail" property="areaname" nbsp="true"/>
				<%}%>
				<a onclick="popBusinessarea()"><custom:button type="3" value="*"/></a>
				
				
            </td> 
                
            -->
          	<!-- 
          	<td>
            <td class="td-text"><%= label.getLabelName("L_Crowd") + label.getLabelName("L_Colon") %></td>
          		<custom:text property="population" name="countyareadetail"  dataType="integer" />
          		<input type="text" name="countyareadetail" value="<custom:write  property="population" name="countyareadetail"/>"/>
          	 -->
 				
 				
 			<td class="td-text"><%= label.getLabelName("L_PopulationNumber") + label.getLabelName("L_Colon") %></td>
            <td><custom:text property="population" name="countyareadetail" dataType="integer" /></td>
 				
            </td>
            
          </tr>
          <tr> 
            
            <td class="td-text"><%= label.getLabelName("L_Countyhospital") + label.getLabelName("L_Colon") %></td>
            <td><custom:text property="countyhospital" name="countyareadetail" dataType="integer" /></td>
            <td class="td-text"><%= label.getLabelName("L_Communityhealthcenter") + label.getLabelName("L_Colon") %></td>
            <td><custom:text property="communityhealthcenter" name="countyareadetail" dataType="integer" /></td>
          	
          </tr>
         
          <tr>
          	<td class="td-text"><%= label.getLabelName("L_Communitydoctor") + label.getLabelName("L_Colon") %></td>
            <td><custom:text property="communitydoctor" name="countyareadetail" dataType="integer" /></td>
            <td class="td-text"><%= label.getLabelName("L_Communitypharmacy") + label.getLabelName("L_Colon") %></td>
            <td><custom:text property="communitypharmacy" name="countyareadetail" dataType="integer" ></custom:text></td>
            
          </tr>
    		
          <tr> 
            <td class="td-text"><%= label.getLabelName("L_Agreementsaler") + label.getLabelName("L_Colon") %></td>
            <td><custom:text property="agreementsaler" name="countyareadetail" dataType="integer" ></custom:text></td>
            <td class="td-text"><%= label.getLabelName("L_Expectcountylevel") + label.getLabelName("L_Colon") %></td>
            <td>
               <custom:selectdic dictType="ExpectCountyLevel" property="expectcountylevel" name="countyareadetail" defaultValue="----" defaultValueCost=" "/>
            </td>
          </tr>
          <tr> 
            
            <td class="td-text"><%= label.getLabelName("L_Nongoalclinic") + label.getLabelName("L_Colon") %></td>
            <td>
               <custom:text name="countyareadetail" property="nongoalclinic" dataType="integer" label="L_Nongoalclinic" command="notnegative"/>
            </td>
            <td class="td-text"><%= label.getLabelName("L_Nongoalpharmacy") + label.getLabelName("L_Colon") %></td>
            <td>
               <custom:text name="countyareadetail" property="nongoalpharmacy"  label="L_Nongoalpharmacy" dataType="integer" command="notnegative"/>
            </td>
          </tr>
          <tr> 
            
            <td class="td-text"><%= label.getLabelName("L_Nongoalhospital") + label.getLabelName("L_Colon") %></td>
            <td>
               <custom:text name="countyareadetail" property="nongoalhospital" dataType="integer" label="L_Nongoalhospital" command="notnegative"/>
            </td>
         	<td class="td-text"><%= label.getLabelName("L_Totalnongoal") + label.getLabelName("L_Colon") %></td>
            <td>
               <custom:text name="countyareadetail" property="totalnongoal" label="L_Totalnongoal" dataType="integer" command="notnegative"/>
            </td>
          </tr>
          <tr>
          	
            <td class="td-text"><%= label.getLabelName("L_YesOrNoPharmacy") + label.getLabelName("L_Colon") %></td>
            <td><custom:selectdic dictType="YesOrNo" property="attr33" name="countyareadetail" defaultValue="----" defaultValueCost=" "></custom:selectdic>
            </td>
            <td class="td-text">&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr> 
          
            <td class="td-text"><%= label.getLabelName("L_Comments") + label.getLabelName("L_Colon") %></td>
            <td colspan="3"> 
               <custom:text name="countyareadetail" property="comments" size="100"/>
            </td>
          </tr>
        </table>
      </td>
  </tr>
  <tr>
    <td class="summary_top"></td>
  </tr>

</form>
</table>
<table width="100%" cellspacing="0" cellpadding="0">
	<tr>
		<td class="td_center">
		<a onclick="__back()"><custom:button type="2" label="L_Back" imgsrc="delete.gif" border="0" style="width:60"/></a>
		</td>
	</tr>
</table>
</body>
<script>
  var list=document.getElementsByTagName("input");
  m=list.length
  list[m-1].style.display='none';
</script>
</html>
